OPENSSL_DIR=$(APPS_DIR)/openssl
OPENSSH_DIR=$(APPS_DIR)/openssh/openssh-7.6p1
OPENSSH_FILE=sftp-client.c sftp-common.c atomicio.c sshbuf.c sshbuf-getput-basic.c ssherr.c xmalloc.c misc.c fatal.c cleanup.c openbsd-compat/explicit_bzero.c openbsd-compat/recallocarray.c openbsd-compat/vis.c openbsd-compat/strlcpy.c openbsd-compat/strlcat.c log.c
OPENSSH_SRC=$(patsubst %.c,$(OPENSSH_DIR)/%.c,$(OPENSSH_FILE))
SRC=sftpc.c sftp_mock.c $(OPENSSH_SRC)

OBJ=$(patsubst %.c, %.o, $(SRC))

CFLAGS= -O2 -Wall -ffunction-sections -fdata-sections
CFLAGS+= -I $(OPENSSH_DIR) -I$(OPENSSL_DIR)/include
TARGET=sftpc


$(TARGET):$(OBJ)
	$(CC) -Wl,--gc-sections -o $@ $^

.PHONY:all
all:$(TARGET)
	

clean:
	rm -f $(OBJ) $(TARGET)
